Telegram Group & Telegram Channel
Делегирующие генераторы

Давайте создадим простенькую генераторную функцию subgen, которая будет возвращать числа от 0 до переданного аргумента.

А также ещё одну генераторную функцию delegator, которая будет возвращать числа из итерируемого объекта source, который передадим в качестве аргумента.

Цикл, который можно написать в delegator, можно заменить всего лишь одной строчкой. То есть yield from заменяет цикл for, в котором только возвращаются значения через yield.

Грубо говоря, такая конструкция является неким туннелем передачи данных туда и обратно. В нашей ситуации delegator можно назвать делигирующим генератором, а subgen подгенератором.

#генераторы



tg-me.com/python_academy/2047
Create:
Last Update:

Делегирующие генераторы

Давайте создадим простенькую генераторную функцию subgen, которая будет возвращать числа от 0 до переданного аргумента.

А также ещё одну генераторную функцию delegator, которая будет возвращать числа из итерируемого объекта source, который передадим в качестве аргумента.

Цикл, который можно написать в delegator, можно заменить всего лишь одной строчкой. То есть yield from заменяет цикл for, в котором только возвращаются значения через yield.

Грубо говоря, такая конструкция является неким туннелем передачи данных туда и обратно. В нашей ситуации delegator можно назвать делигирующим генератором, а subgen подгенератором.

#генераторы

BY Python Academy




Share with your friend now:
tg-me.com/python_academy/2047

View MORE
Open in Telegram


Python Academy Telegram | DID YOU KNOW?

Date: |

That strategy is the acquisition of a value-priced company by a growth company. Using the growth company's higher-priced stock for the acquisition can produce outsized revenue and earnings growth. Even better is the use of cash, particularly in a growth period when financial aggressiveness is accepted and even positively viewed.he key public rationale behind this strategy is synergy - the 1+1=3 view. In many cases, synergy does occur and is valuable. However, in other cases, particularly as the strategy gains popularity, it doesn't. Joining two different organizations, workforces and cultures is a challenge. Simply putting two separate organizations together necessarily creates disruptions and conflicts that can undermine both operations.

Telegram hopes to raise $1bn with a convertible bond private placement

The super secure UAE-based Telegram messenger service, developed by Russian-born software icon Pavel Durov, is looking to raise $1bn through a bond placement to a limited number of investors from Russia, Europe, Asia and the Middle East, the Kommersant daily reported citing unnamed sources on February 18, 2021.The issue reportedly comprises exchange bonds that could be converted into equity in the messaging service that is currently 100% owned by Durov and his brother Nikolai.Kommersant reports that the price of the conversion would be at a 10% discount to a potential IPO should it happen within five years.The minimum bond placement is said to be set at $50mn, but could be lowered to $10mn. Five-year bonds could carry an annual coupon of 7-8%.

Python Academy from sg


Telegram Python Academy
FROM USA